package cn.elead.chaos.shiro.service.impl;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

import cn.elead.chaos.shiro.service.IShiroRealmService;
import cn.elead.chaos.sso.core.user.LoginUser;

public class ShiroRealmService implements IShiroRealmService {

	/**
	 * 获取角色
	 * 
	 * @param userId
	 * @return
	 */
	@Override
	public Set<String> selectRoleKeys(String userId) {
		return Arrays.asList("ADMIN").stream().collect(Collectors.toSet());
	}

	/**
	 * 获取资源权限
	 * 
	 * @param userId
	 * @return
	 */
	@Override
	public Set<String> selectPermsByUserId(String userId) {
		return Arrays.asList("system:user:list", "user:list", "user:get").stream().collect(Collectors.toSet());
		//return Arrays.asList("system:user:list").stream().collect(Collectors.toSet());
	}

	/**
	 * 获取用户信息
	 * 
	 * @param token
	 * @return
	 */
	@Override
	public LoginUser getUser(String token) {
		LoginUser user = new LoginUser();
		user.setLoginName("test");
		return user;
	}
}
